how to retrieve data from database using three tier architecture in c